From 101988d2ec1fee6d37f57e99e31d37554918447e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 26 Jan 2022 11:01:55 +0100 Subject: [PATCH] fw4: fix family comparisons The address family of an object might be either `0` or `null` so loosen the checks to accomodate both. Ref: https://github.com/jow-/ucode/commit/aa860a35252b4833a188f8b2f9c6a7d68963767d Signed-off-by: Jo-Philipp Wich --- root/usr/share/ucode/fw4.uc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index 6973eae..113e4f5 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -264,9 +264,9 @@ function ensure_tcpudp(x) { return false; } -let is_family = (x, v) => (x.family == 0 || x.family == v); -let family_is_ipv4 = (x) => (x.family == 0 || x.family == 4); -let family_is_ipv6 = (x) => (x.family == 0 || x.family == 6); +let is_family = (x, v) => (!x.family || x.family == v); +let family_is_ipv4 = (x) => (!x.family || x.family == 4); +let family_is_ipv6 = (x) => (!x.family || x.family == 6); function infer_family(f, objects) { let res = f; @@ -277,7 +277,7 @@ function infer_family(f, objects) { desc = objects[i + 1]; for (let obj in objs) { - if (!obj || obj.family == 0 || obj.family == res) + if (!obj || !obj.family || obj.family == res) continue; if (res == 0) { -- 2.30.2